<?php

/**
  To use this exmple, you will need the Zend Framework from:

      http://framework.zend.com/download

  For more information on using the Zendr_Rest_Client, see:

      - http://framework.zend.com/manual/en/zend.rest.client.html
      - http://www.pixelated-dreams.com/archives/243-Next-Generation-REST-Web-Services-Client.html
**/

require 'Zend/Rest/Client.php';

$howlr_site_url = "http://localhost:7008";

/**
  If you have your Howlr server configured to require authentication, uncomment the next block
  and change the username ans password to whatever you have in your config.yml file.
**/
//$username = 'howlr';
//$password = 'howl!';
//Zend_Rest_Client::getHttpClient()->setAuth($username, $password);

$rest = new Zend_Rest_Client($howlr_site_url);

$data = array(
	'from' => "Test McTestski <tmctestski@example.foo>",
	'recipients' => "John Doe <jdoe@example.foo>; Sally Smith <ssmith@example.foo>",
	'subject' => "Testing Howlr",
	'body' => "Did it work?"
);

$r = $rest->post('/messages.xml', $data);

/**
  You can also send out HTML emails.
**/

$rest = new Zend_Rest_Client($howlr_site_url);

$html = "
<html>
<head>
	<title>Test</title>
</head>
<body>
	<h1>This is a test!</h1>
	<p>Did it work?</p>
</body>
</html>
";

$data = array(
	'from' => "Test McTestski <tmctestski@example.foo>",
	'recipients' => "John Doe <jdoe@example.foo>",
	'subject' => "Testing Howlr HTML",
	'body' => $html,
	'content_type' => 'text/html'
);

$r = $rest->post('/messages.xml', $data);
 
?>
